package com.eduplatform.dto;

import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Data
public class SubjectDTO {

    private Long id;

    @NotBlank(message = "学科名称不能为空")
    private String name;

    @NotNull(message = "教育阶段不能为空")
    private Integer level;

    private String description;

    private Date createTime;

    private Date updateTime;

    // 教育阶段名称（前端展示用）
    private String levelName;

    public String getLevelName() {
        if (level == null) {
            return "";
        }
        switch (level) {
            case 1:
                return "小学";
            case 2:
                return "初中";
            case 3:
                return "高中";
            case 4:
                return "大学";
            default:
                return "";
        }
    }
}